package com.zhongketech.sunflower.transport.model;

import android.database.sqlite.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;

import com.zhongketech.sunflower.transport.model.SmsCode;
import com.zhongketech.sunflower.transport.model.User;
import com.zhongketech.sunflower.transport.model.School;
import com.zhongketech.sunflower.transport.model.Classes;
import com.zhongketech.sunflower.transport.model.Request;
import com.zhongketech.sunflower.transport.model.Contact;

import com.zhongketech.sunflower.transport.model.SmsCodeDao;
import com.zhongketech.sunflower.transport.model.UserDao;
import com.zhongketech.sunflower.transport.model.SchoolDao;
import com.zhongketech.sunflower.transport.model.ClassesDao;
import com.zhongketech.sunflower.transport.model.RequestDao;
import com.zhongketech.sunflower.transport.model.ContactDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig smsCodeDaoConfig;
    private final DaoConfig userDaoConfig;
    private final DaoConfig schoolDaoConfig;
    private final DaoConfig classesDaoConfig;
    private final DaoConfig requestDaoConfig;
    private final DaoConfig contactDaoConfig;

    private final SmsCodeDao smsCodeDao;
    private final UserDao userDao;
    private final SchoolDao schoolDao;
    private final ClassesDao classesDao;
    private final RequestDao requestDao;
    private final ContactDao contactDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        smsCodeDaoConfig = daoConfigMap.get(SmsCodeDao.class).clone();
        smsCodeDaoConfig.initIdentityScope(type);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        schoolDaoConfig = daoConfigMap.get(SchoolDao.class).clone();
        schoolDaoConfig.initIdentityScope(type);

        classesDaoConfig = daoConfigMap.get(ClassesDao.class).clone();
        classesDaoConfig.initIdentityScope(type);

        requestDaoConfig = daoConfigMap.get(RequestDao.class).clone();
        requestDaoConfig.initIdentityScope(type);

        contactDaoConfig = daoConfigMap.get(ContactDao.class).clone();
        contactDaoConfig.initIdentityScope(type);

        smsCodeDao = new SmsCodeDao(smsCodeDaoConfig, this);
        userDao = new UserDao(userDaoConfig, this);
        schoolDao = new SchoolDao(schoolDaoConfig, this);
        classesDao = new ClassesDao(classesDaoConfig, this);
        requestDao = new RequestDao(requestDaoConfig, this);
        contactDao = new ContactDao(contactDaoConfig, this);

        registerDao(SmsCode.class, smsCodeDao);
        registerDao(User.class, userDao);
        registerDao(School.class, schoolDao);
        registerDao(Classes.class, classesDao);
        registerDao(Request.class, requestDao);
        registerDao(Contact.class, contactDao);
    }
    
    public void clear() {
        smsCodeDaoConfig.getIdentityScope().clear();
        userDaoConfig.getIdentityScope().clear();
        schoolDaoConfig.getIdentityScope().clear();
        classesDaoConfig.getIdentityScope().clear();
        requestDaoConfig.getIdentityScope().clear();
        contactDaoConfig.getIdentityScope().clear();
    }

    public SmsCodeDao getSmsCodeDao() {
        return smsCodeDao;
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public SchoolDao getSchoolDao() {
        return schoolDao;
    }

    public ClassesDao getClassesDao() {
        return classesDao;
    }

    public RequestDao getRequestDao() {
        return requestDao;
    }

    public ContactDao getContactDao() {
        return contactDao;
    }

}
